﻿using System;
using System.Windows;
using Caliburn.Micro;
using JY.IOC;
using JY.IOC.Configuration;
using JY.Wpf.Core.CaseForCaliburn;
using JY.Wpf.TestClient.ViewModels;
using JY.Wpf.Core.Events;
using Newtonsoft.Json;

namespace JY.Wpf.TestClient
{
    /// <summary>
    /// 引导程序
    /// </summary>
    public class Startup : StartupBase
    {
        #region # 构造器
        ///// <summary>
        ///// 构造器
        ///// </summary>
        //public Bootstrapper() : base()
        //{
        //}
        #endregion

        #region # 应用程序启动事件——void OnStartup(object sender, StartupEventArgs e)
        /// <summary>
        /// 应用程序启动事件
        /// </summary>
        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            ResolveMediator.Resolve<IEventAggregator>().PublishOnUIThreadAsync(new WarningMessageEvent("123123"));
            //var splashScreen = new SplashScreen("Images/StartUp.jpg");
            //splashScreen.Show(true);
            this.DisplayRootViewFor<ShellViewModel>();
        }
        #endregion
        #region # 自动登录——virtual void AutoLogin()
        /// <summary>
        /// 自动登录
        /// </summary>
        /// <returns></returns>
        public override void AutoLogin()
        {
            //ResolveMediator.Resolve<IEventAggregator>().PublishOnUIThread(new LoginEvent(SystemConfig.UserName, SystemConfig.Password));
        }
        #endregion

        #region # 异常处理
        #endregion
    }
}
